#Parzen window classifier

#result matrix contains two rows: 1st: occurencies of each class in the testset, 2nd: classification errors within each class
#
#train - matrix of samples(rows) and their relevant attributes (cols) prepended by class id (1st col)
#test - same as above 
#apriori
#width - width of parzen window

function report=coreTask3(train,test,apriori=[0.25,0.25,0.25,0.25],width=0.001)
    samples=[0,0,0,0];
    errors=[0,0,0,0];
    for(e=1:size(test,1))
        pds=[0,0,0,0];
        for(i=1:4)
            pds(i)=parzen(test(e,2:end),train(train(:,1)==i,:)(:,2:end),width);
        end;
        pds=pds.*apriori;       
        [classPts, classNo] = max(pds);
        if(classNo!=test(e,1))
            errors(1,test(e,1))+=1;
        endif;
        samples(1,test(e,1))+=1;
    end;
    report=[samples;errors];
end;
